<?php

/**
 * 
 */
class Admin_UsuarioController extends App_Controller_Default
{
	/**
     * 
     * @var Model_Mapper_Usuario
     */
    protected $_mapper;
    
    /**
     * 
     * @var Admin_Form_Usuario
     */
    protected $_form;

    /**
     * (non-PHPdoc)
     * @see Zend_Controller_Action::init()
     */
    public function init()
    {
    	$this->_mapper = new Model_Mapper_Usuario();
    }
    
    /**
     * 
     * @access 	protected
     * @param 	string $action
     * @return 	Admin_Form_Usuario
     */
    protected function _getForm ( $action )
    {
    	if ( is_null($this->_form) ) {
    		
    		$this->_form = new Admin_Form_Usuario();
    		$this->_form->setAction( $action );
    		
    	}
    	
    	return $this->_form;
    }
    
    /**
     * 
     * @access public
     * @return void
     */
    public function editPostHook()
    {
    	$form = $this->view->form;
    	
    	$form->getElement('user_senha')->setRequired( false );
    	$form->getElement('confirma_senha')->setRequired( false );
    	
    	$form->getElement('user_email')->setAttrib( 'readOnly', true );
    }
}